22.02.10 - Introduction to Objected Oriented Desig
Object Orientation
- OO systems are viewed as compositions of domain specific object abstractions, rather than data and functions
- Objects associate data and behaviour
- In a system they intercommunicate by sending messages to each other
- Synchronous - method/function call
- Asynchronous - Leave a message
- An object is a domain conceptSetter - Method which allows us to set the value of the data in the object Getter - Method which allows us to get the current value of the data in the object
- State - data
- Behaviour - methods
- Identity - unique identifier
Decomposition
Reduces how much you have to consider at the same time Procedural Decomposition splits the program into a number of procedures/functions Fewer interacting things make the problem simpler in mind Involves modelling the world in objects rather than functions
Identifying classes and objects
Java classes already exist for most of what we would want to do Abstraction means that we can deal with the classes on the basis of 'what they do' not 'how they do it'
Summary
Can decompose tasks into interacting objects Can add functions/methods to classes
objectRef.methodName()
These methods refer to the data for the current object